﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using SY.BasicData.Api.Write.Basic.Applications.Cultivation.Command;
using SY.BasicData.ErrorCode;
using SY.BasicData.Infrastructures;

namespace SY.BasicData.Api.Write.Controllers
{
    /// <summary>
    /// 养殖信息
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class WriteCultivationController : ControllerBase
    {
        private readonly IMediator mediator;
        private readonly ILogger<WriteCultivationController> logger;

        public WriteCultivationController(IMediator mediator, ILogger<WriteCultivationController> logger)
        {
            this.mediator = mediator;
            this.logger = logger;
        }
        /// <summary>
        /// 养殖免疫信息添加
        /// </summary>
        /// <param name="command">命令</param>
        /// <returns>返回受影响的行数</returns>
        [HttpPost]
        public async Task<ApiResult<int>> AddImmunity([FromBody] AddImmunityCommand command)
        {
            //if (command == null || command.immunityModels == null || !command.immunityModels.Any())
            //{
            //    return new ApiResult<int>
            //    {
            //        Code = ApiEnum.Fail,
            //        Message = "请求数据不能为空",
            //        Data = 0
            //    };
            //}
            
            return await mediator.Send(command);
        }
    }
}
